from google.appengine.ext import db

class Wish(db.Model):
    
    owner_id = db.StringProperty()
    reserver_id = db.StringProperty()
    title = db.StringProperty()
    description = db.TextProperty()
    tags = db.StringListProperty()
    link = db.StringProperty()
    image = db.BlobProperty()
    price_from = db.IntegerProperty()
    price_to = db.IntegerProperty()
    reason_id = db.IntegerProperty()
    category_id = db.IntegerProperty(default=0)
    # 0 > deleted, 1 > active, 2 done
    status = db.IntegerProperty(default=1)
    platform_id = db.IntegerProperty(default=0)
    likers = db.StringListProperty()
    likes = db.IntegerProperty(default=0)
    updated = db.DateTimeProperty(auto_now=True)
    created = db.DateTimeProperty(auto_now_add=True)
    
class User(db.Model):
    
    user_id = db.StringProperty()
    name = db.StringProperty(default="")
    likes = db.StringListProperty()
    ws_count = db.IntegerProperty(default=0)
    rs_count = db.IntegerProperty(default=0)
    inv_count = db.IntegerProperty(default=0)
    status = db.IntegerProperty(default=1)
    created = db.DateTimeProperty(auto_now_add=True)
    
class Stats(db.Model):
    
    hash_id = db.StringProperty()
    
    users = db.IntegerProperty(default=0)
    wishes = db.IntegerProperty(default=0)
    reservations = db.IntegerProperty(default=0)
    invites = db.IntegerProperty(default=0)
    
    date = db.DateProperty(auto_now_add=True)
    
class Tag(db.Model):
    
    name = db.StringProperty()
    count = db.IntegerProperty(default=1)